<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link href="./css/api.css" rel="stylesheet"/>
  <link href="./css/element.css" rel="stylesheet"/>
  <link href="./css/base.css" rel="stylesheet"/>
  <title>评估</title>
  <style>
    .el-form-item__label{
      display: block;
      float: none;
      text-align: left;
      border-left: 2px solid #f00;
      padding-left: 1rem;
      height: auto;
      line-height: inherit;
    }.el-form-item__content{
      margin-left: 1.2rem;
      margin-top: 1rem;
    }.el-radio__input{
      display: none;
    }.el-radio{
      background-color: #fff;
      box-shadow:0px 0px 5px 0px rgba(0,0,0,0.15);
      text-align: center;
      border-radius: .2rem;
      width: 5rem;
      height: 2rem;
      line-height: 2rem;
      padding: 0;
      display: inline-block;
    }.el-radio.is-checked{
      background-color: #FF3C3C;
    }.el-radio__input.is-checked+.el-radio__label{
      color: #fff;
    }.el-radio__label{
      padding: 0;
    }.el-textarea__inner{
      height: 6rem;
      border: 0;
      background-color: #ECECEC;
    }
  </style>
</head>
<body>
  <div id="vm" v-cloak>
    <header class="x-header">
      <i class="el-icon-arrow-left x-closewin-icon" @click="closethiswin"></i>
      <div class="x-header-t">评估</div>
    </header>
    <div class="x-assa-form">
      <el-form ref="form" :model="form" :label-position="top">
        <el-form-item label="是否需要下轮面试">
          <el-radio-group v-model="form.isnext">
            <el-radio :label="1">是</el-radio>
            <el-radio :label="2">否</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="请选择下轮面试官">
          <el-select v-model="form.nextface" placeholder="请选择">
            <el-option label="未选择" value=""></el-option>
            <el-option :label="item.username" :value="item.id" v-for="item in hrlistdata" :key="item.key"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="选择人才来源">
          <el-radio-group v-model="form.nextfrom">
            <el-radio :label="1">社招</el-radio>
            <el-radio :label="2">校招</el-radio>
            <el-radio :label="3">学校资源</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="评价填写">
          <el-input type="textarea" v-model="form.nextgood"></el-input>
        </el-form-item>
        <!-- <el-form-item>
        </el-form-item> -->
      </el-form>
    </div>
    <div class="x-mana-btn" @click="assesubmit">提交</div>
  </div>
  <script type="text/javascript" src="./script/vue.js"></script>
  <script type="text/javascript" src="./script/element.js"></script>
  <script type="text/javascript" src="./script/api.js"></script>
  <script type="text/javascript" src="./js/base.js"></script>
  <script>
  apiready = function () {
    var middata = api.pageParam.id;
    console.log(middata);
      //
    var vm = new Vue({
      el:'#vm',
      data(){
        return{
          form:{
            isnext:'',
            nextface:'',
            nextfrom:'',
            nextgood:''
          },
          hrlistdata:'',
          thismiddata:''
        }
      },
      created:function() {
        var that=this;

      },
      mounted:function(){
        var that=this;
        that.thismiddata = middata;
        console.log(that.thismiddata);
        that.gethrlist()
      },
      methods: {
        gethrlist:function(){
          var that=this;
          api.ajax({
            url:manaurl+'hrList',
            methods:'get',
            data:{
              values:{
                sec:$api.getStorage('usertoken')
              }
            }
          },function(ret,err){
            if(ret){
              api.hideProgress();
              console.log(JSON.stringify(ret));
              if(ret.status == 1){
                that.hrlistdata = ret.data.list;

              }else{
                api.toast({
                    msg: ret.msg,
                    duration: 3000,
                    location: 'bottom'
                });
              }
            }else{
              api.hideProgress();
              console.log(JSON.stringify(err));
              api.toast({
                  msg: err.msg,
                  duration: 3000,
                  location: 'bottom'
              });
            }
          })
        },
        assesubmit:function(){
          var that=this;
          console.log(that.form.nextfrom);
          console.log(that.form.nextface);
          console.log(that.form.nextgood);
          if(that.form.isnext=='2'){
            that.form.nextface = ''
          }
          api.ajax({
            url:manaurltwo+'screen',
            methods:'get',
            data:{
              values:{
                sec:$api.getStorage('usertoken'),
                type:1,
                referrer:that.form.nextfrom,
                hrId:that.form.nextface,
                comment:that.form.nextgood,
                mid:that.thismiddata
              }
            }
          },function(ret,err){
            if(ret){
              api.hideProgress();
              console.log(JSON.stringify(ret));
              if(ret.status == 1){
                api.sendEvent({
                    name: 'assessmentok',
                    extra: {}
                });
                openmanawin('submitreview','submitreview.html','assok')

              }else{
                api.toast({
                    msg: ret.msg,
                    duration: 3000,
                    location: 'bottom'
                });
              }
            }else{
              api.hideProgress();
              console.log(JSON.stringify(err));
              api.toast({
                  msg: err.msg,
                  duration: 3000,
                  location: 'bottom'
              });
            }
          })
        },
      }
    })
  }
  </script>
</body>
</html>
